﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.TrainingsRequestsExt>" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="TrainingRequest.Models" %>

<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdTrainingsParticipant";
                                        settings.KeyFieldName = "IdTrainingsParticipant";
                                        settings.CallbackRouteValues =
                                            new { Controller = "TC", Action = "TrainingsParticipantsPartial", key = Model.Key };
                                        settings.SettingsPager.PageSize = 20;

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = "ФИО";
                                            column.FieldName = "ParticipantName";
                                            settings.Width = 100;
                                        });

                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = "Должность";
                                            column.FieldName = "ParticipantPosition";
                                            settings.Width = 100;
                                        });

                                        //if(Model.Request.IdTrainingsRequest > 0)
                                        //{
                                        //    settings.Columns.Add(column =>
                                        //    {
                                        //        column.FieldName = "IdTrainingsParticipantsStatus";
                                        //        column.Caption = Resourses.TrainingParticipantsStatus;
                                        //        column.ColumnType = MVCxGridViewColumnType.ComboBox;
                                        //        column.ReadOnly = false;
                                                
                                        //        var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
                                        //        if (comboBoxProperties != null)
                                        //        {

                                        //            comboBoxProperties.DataSource = DB.GetLocalizedTrainingParticipantsStatusesNames(Thread.CurrentThread.CurrentCulture.ToString());
                                        //            comboBoxProperties.TextField = "LocaLizedString";
                                        //            comboBoxProperties.ValueField = "Id";
                                        //            comboBoxProperties.ValueType = typeof(int);
                                        //        }
                                        //    });
                                        //}

                                        settings.CommandColumn.Visible = true;
                                        settings.CommandColumn.NewButton.Visible = true;
                                        settings.CommandColumn.DeleteButton.Visible = true;
                                        settings.CommandColumn.EditButton.Visible = true;
                                        settings.SettingsBehavior.ConfirmDelete = true;
                                        settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
                                        settings.Width = 500;
                                        settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "TC", Action = "TrainingsParticipantsPartialAdd", key = Model.Key };
                                        settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "TC", Action = "TrainingsParticipantsPartialDelete", key = Model.Key };
                                        settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "TC", Action = "TrainingsParticipantsPartialUpdate", key = Model.Key };
                                    }).Bind(Model.ParticipantsList).GetHtml();
%>